#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import os
import sys


def main():

    sourcefile=sys.argv[1]
    
    
    if not os.path.exists(sourcefile):
        print('source is invalid')
        exit(1)

    counter=0
    # print('ok')
    with open(sourcefile,mode='r') as source:
        for line in source:
            #print(line)
            line=line.strip()
            triple = line.split(' ')
            #print(triple)
            if triple[0] == triple[1]:
                counter = counter+1
        source.close()
    print(counter)

    
if __name__=='__main__':
    main()
    
